import {FileInfo} from "../types";
import {FileUtil} from "../utils/FileUtil";

export class FileScanner {

  private static map = new Map<string, FileInfo[]>();

  public static async getChildren(path: string): Promise<FileInfo[] | undefined> {
    const children = await FileUtil.getDirectoryChildren(path)
    if (children && children.length > 0) {
      this.map.set(path, children);
    }
    return this.map.get(path);
  }
}
